package com.phoxell.admin;

import com.phoxell.Serial;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class FlagsServlet extends HttpServlet{
	public void doGet(HttpServletRequest req, HttpServletResponse rsp)
			throws IOException{
		try{
			rsp.setContentType("text/plain");
			String p=req.getParameter("v");
			if(p!=null && p.length()>0){
				long v=Long.parseLong(p);
				p=req.getParameter("i").trim();
				if(p!=null && p.length()>0){
					Serial a=new Serial(p);
					a.setFlags(v);
					a.update(false);
					PrintWriter w=rsp.getWriter();
					w.println(a.getSteps());
				}
			}
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}